package main

import (
	"TodoProject/dao"
	"TodoProject/models"
	"TodoProject/routers"
)

func main() {
	//初始化数据库
	err := dao.InitDatabase()
	if err != nil {
		panic(err)
	}

	//延迟关闭数据库
	defer dao.CloseLinkedDatabase()

	//绑定数据模型
	dao.DB.AutoMigrate(&models.ToDo{})

	//
	r := routers.SetupRouter()
	r.Run(":9000")

}
